package dbsync4j.core.loader.crawler;

import java.sql.DatabaseMetaData;

import dbsync4j.core.behavior.DatabaseObject;
import dbsync4j.core.loader.behavior.DatabaseLoader;
import dbsync4j.core.types.IndexType;

public class CrawlerIndexTypeLoader implements DatabaseLoader<IndexType>{

	@Override
	public IndexType loadDatabaseObject(Object schemaObject) {
		
		schemacrawler.schema.IndexType crawlerIndexType = (schemacrawler.schema.IndexType) schemaObject;
		
		IndexType indexType = null;

		switch (crawlerIndexType.getId()) {
			case -1: indexType = IndexType.unknown;	break;
			case DatabaseMetaData.tableIndexStatistic: indexType = IndexType.unknown; break;
			case DatabaseMetaData.tableIndexClustered: indexType = IndexType.clustered; break;
			case DatabaseMetaData.tableIndexHashed: indexType = IndexType.hashed; break;
			case DatabaseMetaData.tableIndexOther: indexType = IndexType.other; break;
		}
		
		return indexType;
	}

	@Override
	public void setDependantObjectOwner(DatabaseObject databaseObject) {
		// TODO Auto-generated method stub
		
	}

}
